#
info = []
def printInfo():
    """显示功能界面"""
    print("请选择功能序号---------")
    print("1.添加学员")
    print("2.删除学员")
    print("3.修改学员")
    print("4.查询学员")
    print("5.显示所有学员")
    print("6.退出系统")
    print("-" * 20)

def add_st():
    name = input("请输入学员姓名:")
    card = input("请输入学员学号:")
    phone = input("请输入学员手机号:")
    global info
    for i in info:
        if name == i['name']:
            print("学员已经存在")
            return
    else:
        dict = {}
        dict['name'] = name
        dict['card'] = card
        dict['phone'] = phone
        info.append(dict)
    print(info)

def del_st():
    name = input("请输入学员姓名:")
    card = input("请输入学员学号:")
    phone = input("请输入学员手机号:")
    global info
    for i in info:
        if name == i['name']:
            info.remove(i)
            break
    else:
        print("该学员不存在")
def find_st():
    name = input("请输入学员姓名")
    global info
    for i in info:
        if name == i["name"]:
            print(i)
            break
    else:
        print(f"学员{name}不存在")
while True:
    printInfo()
    num = input("请输入功能序号:")
    if num == "1":
        # print("添加学员")
        add_st()
    elif num == "2":
        # print("删除学员")
        del_st()
    elif num == "3":
        print("修改学员")
    elif num == "4":
        # print("查询学员")
        find_st()
    elif num == "5":
        print("显示所有学员")
    elif num == "6":
        # print("退出系统")
        break
    else:
        print("功能序号错误")